<?php

define('BASE_ROOT_PATH', dirname(dirname(__FILE__)));
include_once( BASE_ROOT_PATH . "/word/db/DBMySQL.php");

//用户信息
$db = new DBMySQL();
$rs = $db->Query("select * from advertising_image");
if(empty($rs)) {
	$msg = json_encode("没有广告内容");
	echo '{"code":"1","msg":'.$msg.'}';
	exit();
}

$val = $rs[0];

$imageUrl= $val['image_url'];
if(empty($imageUrl)) {
	$imageUrl= '';
}
else {
	$imageUrl ="http://www.wordhot.net/wordhot/controllers/pic/".$imageUrl;
}
$title= $val['title'];
if(empty($title)) {
	$title= '';
}
$subTitle= $val['subtitle'];
if(empty($subTitle)) {
	$subTitle= '';
}

$linkurl= $val['link_url'];
if(empty($linkurl)) {
	$linkurl= '';
}

$data = json_encode(array('imageurl' =>$imageUrl,
	        'title' =>$title,
	        'subtitle' =>$subTitle,
	        'linkurl' =>$linkurl));

echo '{"code":"0","data":'.$data.'}';

?>